package com.lrkj.ureport.service.impl;

import java.util.List;
import com.lrkj.common.utils.DateUtils;
import com.lrkj.common.utils.uuid.IdUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.lrkj.ureport.mapper.ReportGroupMapper;
import com.lrkj.ureport.domain.ReportGroup;
import com.lrkj.ureport.service.IReportGroupService;

/**
 * 报分组Service业务层处理
 *
 * @author yajun_ren
 * @date 2022-04-01
 */
@Service
public class ReportGroupServiceImpl implements IReportGroupService
{
    @Autowired
    private ReportGroupMapper reportGroupMapper;

    /**
     * 查询报分组
     *
     * @param id 报分组ID
     * @return 报分组
     */
    @Override
    public ReportGroup selectReportGroupById(String id)
    {
        return reportGroupMapper.selectReportGroupById(id);
    }

    /**
     * 查询报分组列表
     *
     * @param reportGroup 报分组
     * @return 报分组
     */
    @Override
    public List<ReportGroup> selectReportGroupList(ReportGroup reportGroup)
    {
        return reportGroupMapper.selectReportGroupList(reportGroup);
    }

    /**
     * 新增报分组
     *
     * @param reportGroup 报分组
     * @return 结果
     */
    @Override
    public int insertReportGroup(ReportGroup reportGroup)
    {
        reportGroup.setId(IdUtils.simpleUUID());
        reportGroup.setCreateTime(DateUtils.getNowDate());
        return reportGroupMapper.insertReportGroup(reportGroup);
    }

    /**
     * 修改报分组
     *
     * @param reportGroup 报分组
     * @return 结果
     */
    @Override
    public int updateReportGroup(ReportGroup reportGroup)
    {
        reportGroup.setUpdateTime(DateUtils.getNowDate());
        return reportGroupMapper.updateReportGroup(reportGroup);
    }

    /**
     * 批量删除报分组
     *
     * @param ids 需要删除的报分组ID
     * @return 结果
     */
    @Override
    public int deleteReportGroupByIds(String[] ids)
    {
        return reportGroupMapper.deleteReportGroupByIds(ids);
    }

    /**
     * 删除报分组信息
     *
     * @param id 报分组ID
     * @return 结果
     */
    @Override
    public int deleteReportGroupById(String id)
    {
        return reportGroupMapper.deleteReportGroupById(id);
    }
    /**
     * 批量新增报分组信息
     *
     * @param reportGroups 报分组对象
     */
    public int batchAddData(List<ReportGroup> reportGroups)
    {
           return reportGroupMapper.batchAddData(reportGroups);
    }
}
